<!doctype html>
<#assign ctx=springMacroRequestContext.contextPath />
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>调度系统</title>
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <link rel="stylesheet" href="${ctx}/css/font.css">
        <link rel="stylesheet" href="${ctx}/css/xadmin.css">
         <link rel="stylesheet" href="${ctx}/css/theme10.css">
        <script src="${ctx}/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="${ctx}/js/xadmin.js"></script>
        <link rel="shortcut icon" href="${ctx}/images/favicon.ico"/>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <script>
            // 是否开启刷新记忆tab功能
            var is_remember = false;
        </script>
    </head>
    <body class="index">
        <!-- 顶部开始 -->
        <div class="container">
            <div class="logo">
                <a href="" target="_blank">调度系统</a>
            </div>
            <div class="left_open">
                <a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
            </div>
            <ul class="layui-nav right">
                <li class="layui-nav-item">
                    <a href="javascript:;">${userInfo.username}</a>
                    <dl class="layui-nav-child">
                        <!-- 二级菜单 -->
                        <dd>
                            <a onclick="openEditPwdDialog();">修改密码</a>
                        </dd>
                        <dd>
                            <a href="${ctx}/logout">退出</a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
        <!-- 顶部结束 -->
        <!-- 中部开始 -->
        <!-- 左侧菜单开始 -->
        <div class="left-nav">
            <div id="side-nav">
                <ul id="nav">
                    <li>
                        <a onclick="xadmin.add_tab('任务管理','${ctx}/job-list',true)">
                            <i class="iconfont left-nav-li" lay-tips="任务管理">&#xe6bb;</i>
                            <cite>任务管理</cite>
                        </a>
                    </li>
                    <li>
                        <a onclick="xadmin.add_tab('用户管理','${ctx}/user-list',true)">
                            <i class="iconfont left-nav-li" lay-tips="用户管理">&#xe6b8;</i>
                            <cite>用户管理</cite>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- <div class="x-slide_left"></div> -->
        <!-- 左侧菜单结束 -->
        <!-- 右侧主体开始 -->
        <div class="page-content">
            <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
                <ul class="layui-tab-title">
                    <li class="home" onclick="reloadData();">
                        <i class="layui-icon">&#xe68e;</i>统计中心
                    </li>
                </ul>
                <div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">
                    <dl>
                        <dd data-type="this">关闭当前</dd>
                        <dd data-type="other">关闭其它</dd>
                        <dd data-type="all">关闭全部</dd></dl>
                </div>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <iframe id="home_iframe" src='${ctx}/job-report' frameborder="0" scrolling="yes" class="x-iframe"></iframe>
                    </div>
                </div>
                <div id="tab_show"></div>
            </div>
        </div>
        <div class="page-content-bg"></div>
        <!-- 右侧主体结束 -->
        <!-- 中部结束 -->
        <!-- 修改密码弹窗 -->
        <div id="edit-pwd-content" style="padding: 30px 50px 0 0;display: none;">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>原始密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="old_pwd" lay-verify="title" autocomplete="off" placeholder="请输入原始密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>新密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="new_pwd" lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </form>
        </div>
    </body>

    <script>
        // 重新加载统计页面数据
        function reloadData() {
            $('#home_iframe').attr('src',$('#home_iframe').attr('src'));
        }
        // 打开修改密码弹窗
        function openEditPwdDialog() {
            layui.use(['layer'], function(){
                var layer = layui.layer;

                layer.open({
                    type: 1
                    ,title: '修改密码'
                    ,offset: 'top'
                    ,closeBtn: false
                    ,area: ['450px','250px']
                    ,shade: 0.4
                    ,btn: ['修改', '取消']
                    ,btn1: function(index){
                        let oldPwd = $('#old_pwd').val();
                        let newPwd = $('#new_pwd').val();
                        if (!oldPwd || !newPwd) {
                            layer.msg('必填项不能为空',{offset:'top',icon:5,time : 1000});
                            return false;
                        }
                        //设置遮罩层
                        var loading = layer.msg('提交中', {icon: 16, shade: 0.3, time:0});
                        $.ajax({
                            type: 'post',
                            url: '${ctx}/user/editPwd',
                            data: {'oldPwd':oldPwd,'newPwd':newPwd},
                            dataType: 'json',
                            success: function(res) {
                                layer.close(loading);
                                if (res.status == 200) {
                                    layer.msg(res.message);
                                    $('#edit-pwd-content').hide();
                                    layer.close(index);
                                } else {
                                    layer.msg(res.message,{offset:'top',icon:5});
                                }
                            }
                        });
                    }
                    ,btn2: function(index){
                        $('#edit-pwd-content').hide();
                        layer.close(index);
                    }
                    ,content: $('#edit-pwd-content')
                });
            });
        }
    </script>

</html>